<%@page import="cn.com.dhcc.app.pub.module.logmgr.service.LogMgrService"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>${appname}</title>
<%@ include file="/WEB-INF/view/common/css_js_ace.jsp"%>
<script type="text/javascript">
	$('.tipMe').tooltip({'placement':'top'});
	function search(form) {
		$(form).appendMenuStr('${menucode_key}');
		$(form).appendPagerParaStr();
		return true;
	}
</script>
<%
 	String[] includeCanSeeLogType = LogMgrService.getCanSeeLogTypes(session,null);
	String includeStr  = "";
	if(includeCanSeeLogType!=null){
		for(String icslt : includeCanSeeLogType){
			includeStr += icslt+",";
		}
	}
	request.setAttribute("includeStr", includeStr) ;
%>
</head>
<style type="text/css">
th{word-break: keep-all;white-space:nowrap;}
</style>
<body>
	<%-- <%@ include file="/WEB-INF/view/common/topbar.jsp"%> --%>
	<div class="main-container" id="main-container">
		<div class="main-container-inner">
			<%-- <%@ include file="/WEB-INF/view/common/sidebar.jsp"%> --%>
			<div class="main-content" style="margin-left: 0px;">
				<div class="breadcrumbs" id="breadcrumbs">
					<ul class="breadcrumb" style="margin-left: 4px;">
						<li><i class="icon-home home-icon"></i>首页
						</li>
						<li>通用模块
						</li>
						<li class="active">日志管理</li>
					</ul>
				</div>

				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">

							<div class="widget-box">
								<div class="widget-header widget-header-flat">
									<h5 class="smaller lighter">
										<i class="icon-list"> &nbsp;日志列表</i> &nbsp;
									</h5>
								</div>

								<div class="widget-body">
									<div class="widget-main">
										<form id="searchForm" class="form-search"
											action="${ctx}/pub/sysmgr/logmgr/list.do"
											method="post" onsubmit="return search(this)">
											<div class="row mg-top12">
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">模&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;块</span> <input
															class="form-control" type="text" name="module" id="module"
															value="${param.module}" />
													</div>
												</div>
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">操&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;作</span> <input
															class="form-control" type="text" name="action" id="action"
															value="${param.action}" />
													</div>
												</div>
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">日&nbsp;志&nbsp;类&nbsp;型&nbsp;</span> 
															<select name="logType" id="logType" style="width:100% ">
																<option value="">-请选择-</option>
																 ${cm:ctoptionExt2("LOG_TYPE",param.logType,includeStr,null) }
															</select>
													</div>
												</div>
										</div>
										<div class="row mg-top12">
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">日&nbsp;志&nbsp;级&nbsp;别&nbsp;</span> <input
															class="form-control" type="text" name="level" id="level"
															value="${param.level}" />
													</div>
												</div>
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">操作用户名</span> <input
															class="form-control" type="text" name="userName" id="userName"
															value="${param.userName}" />
													</div>
												</div>
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">客&nbsp;户&nbsp;端&nbsp;IP&nbsp;</span> <input
															class="form-control" type="text" name="requestIp" id="requestIp"
															value="${param.requestIp}" />
													</div>
												</div>
										</div>
										<div class="row mg-top12">
												
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">日&nbsp;志&nbsp;信&nbsp;息&nbsp;</span> <input
															class="form-control" type="text" name="msg" id="msg"
															value="${param.msg}" />
													</div>
												</div>
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-btn">
															<button type="submit" class="btn btn-purple btn-sm">
																<i class="icon-search icon-on-right bigger-110"></i> 查询
															</button>&nbsp;&nbsp; </span>
													</div>
												</div>
											</div>
										</form>
									</div>
								</div>
							</div>

							<div class="hr hr12 hr-dotted"></div>

							<div id="optDiv">
								<div class="table-responsive">
									<table id="sample-table-1"
										class="table table-striped table-bordered table-hover">
										<thead>
											<tr>
												<th>模块</th>
												<th>操作</th>
												<th>操作用户名(ID)</th>
												<th>客户端IP</th>
												<th>结果&nbsp;</th>
												<th>日志类型</th>
												<th>日志级别</th>
												<th>代码行</th>
												<th>日志信息</th>
												<th>堆栈信息</th>
												<th>日志时间</th>
											</tr>
										</thead>

										<tbody>
											<c:forEach var="vo" items="${logs}">
												<tr>
													<td style="word-break: keep-all;white-space:nowrap;">${vo.module}&nbsp;</td>
													<td >${cm:lmitStrPx(vo.action,200)}&nbsp;</td>
													<td >${vo.userName}(${vo.userId})&nbsp;</td>
													<td >${vo.requestIp}&nbsp;</td>
													<td >${cm:succesFailStr(vo.result)}&nbsp;</td>
													<td > ${cm:ctname("LOG_TYPE",vo.logType) }&nbsp;</td>
													<td >${vo.level}&nbsp;</td>
													<td >${cm:lmitStrPx(vo.line,200)}&nbsp;</td>
													<td ><span class="tipMe" title="${vo.msg}">${cm:lmitStrPx(vo.msg,200)}&nbsp;</span></td>
													<td ><span class="tipMe" title="${vo.throwMsg}">${cm:lmitStrPx(vo.throwMsg,200)}&nbsp;</span></td>
													<td><fmt:formatDate value="${vo.logTime}" pattern="yyyy-MM-dd HH:mm:ss" />&nbsp;</td>
												</tr>
											</c:forEach>
										</tbody>
									</table>

									<jsp:include page="/WEB-INF/view/common/pg.jsp">
										<jsp:param value="${ctx}/pub/sysmgr/logmgr/list.do"
											name="url" />
										<jsp:param value="${_total}" name="total" />
										<jsp:param value="${_urlpara}" name="urlpara" />
									</jsp:include>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
